package com.hl.web.fore;

import com.hl.pojo.Wenzhang;
import com.hl.service.WenzhangService;
import com.hl.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/wenzhang")
public class WenzhangController {
    @Autowired
    private WenzhangService wenzhangService;

    @RequestMapping("/add")
    public ResultEntity add(@RequestBody Wenzhang wenzhang){
        wenzhangService.add(wenzhang);
        return ResultEntity.ok();
    }

    @RequestMapping("/del")
    public ResultEntity del(@RequestBody Wenzhang wenzhang){
        wenzhangService.del(wenzhang);
        return ResultEntity.ok();
    }

    @RequestMapping("/findAll")
    public ResultEntity findAll(){
        return ResultEntity.ok(wenzhangService.findAll());
    }
}
